from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time

path = "https://www.zhipin.com/c101210100-p100109/?ka=sel-city-101210100"

def Selenium_Cookies(URL):
    USER_AGENT = 'user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36'
    chrome_options = Options()
    chrome_options.add_argument('--headless')
    chrome_options.add_argument(USER_AGENT)
    web = webdriver.Chrome('/usr/local/bin/chromedriver',options=chrome_options)
    web.get(URL)  
    time.sleep(3)
    getCookies = web.get_cookies()
    getCookies = getCookies[::-1]
    Cookies = ""
    for cookie in getCookies:
        name = cookie.get('name')
        value = cookie.get('value')
        Cookies += name + "=" +value + " "
    print(Cookies)  
    print("\n"+"Selenium get Cookies Done!")
    print('---------NEXT-------->>>>>')
    web.quit()
    return(Cookies)

Selenium_Cookies(path)
